package hd.cls6;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

/**
 * @author oldliu
 * @since 1.0
 */
public class FileTest2 {
    public static void main(String[] args) {
        //字节输入
        try {
            FileInputStream fin = new FileInputStream("f:/file.txt");
            System.out.println("支持流标记？" + fin.markSupported());
//            int ch = fin.read();
//            System.out.println((char) ch);
//            fin.skip(10);
//            while ((ch = fin.read()) != -1) {
//                System.out.print((char) ch);
//            }
            ///2:缓冲区
            byte[] b = new byte[100];
            int len = 0;
            while ((len = fin.read(b)) != -1) {
                String str = new String(b, 0, len, "gbk");
                System.out.print(str);
            }
            fin.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
